function xsol= myfunction(n,lambdav,Lambdac)
muc=0.033;
C=40;
Pv=Gaussiandist(n);
Pc=Gaussiandist(n);
%%%%%%%%%%%%%%%
% Pv=decreasingdist(n);
% Pc=Gaussiandist(n);
% %%%%%%%%%%%%
% Pv=decreasingdist(n);
% Pc=equaldist(n);
%%%%%%%%%%%
%filling the matrix A1
A1 = zeros(n,n+1);
A1(1,1) = Pv(1);
A1(n,1)= -Pv(1);
for i=2:n
    A1(i,i )= Pv(i);
    A1(i-1,i) = -Pv(i);
end 
A1=lambdav*A1;
for i=1:n;
 A1(i,n+1)=1;
end
for i=1:n
Probabilitiesv(i,1)=Pv(i); 
Probabilitiesc(i,1)=Pc(i); 
end
lambdavi=lambdav*Probabilitiesv;
Lambdaci=Lambdac*Probabilitiesc;
b1=lambdavi-Lambdaci;
c=zeros(n,1);c(n+1)=-1;
A2=zeros(1,n+1);
for i=1:n
A2(1,i)=-lambdavi(i,1);
end
b2=ones(1,1)*muc*n*C - lambdav;
A3=zeros(1,n+1);
A3(1,1)=lambdavi(1,1);
b3=ones(1,1)*muc;
A=[A1;A2;A3];
b=[b1;b2;b3];
%upper and lower bound of X
lb=zeros(n+1,1);
ub=ones(n,1);
ub(n+1,1)=-log(0);
[xsol,fval,exitflag,output,lamd] = linprog(c,A,b,[],[],lb,ub);
xsol=xsol(1:n);
end